@echo off

cd /d %~dp0

echo -- info,add p2pcpp.exe into firewall rules.
set cur_dir=%cd%

cd %cd%\..
set p2pcpp_home=%cd%
cd %cur_dir%

echo -- info, current dir:%cd%
echo -- info, p2pcpp_home dir:%p2pcpp_home%

netsh advfirewall firewall delete rule name="p2pcpp_in"
netsh advfirewall firewall delete rule name="p2pcpp_out"

netsh advfirewall firewall add rule name="p2pcpp_in" dir=in action=allow program="%p2pcpp_home%\bin\p2pcpp.exe" enable=yes
netsh advfirewall firewall add rule name="p2pcpp_out" dir=out action=allow program="%p2pcpp_home%\bin\p2pcpp.exe" enable=yes 

netsh advfirewall firewall show rule name="p2pcpp_in"
netsh advfirewall firewall show rule name="p2pcpp_out"
pause



